package com.pig.pojo.commgoods;
import java.io.Serializable;
import java.util.List;

/**
 * 用于封装业务层传输给控制层的对象
 */
public class PageObject<E> implements Serializable {
    private static final long serialVersionUID = 6734206449519271780L;
    /**
     * 每页条数
     */
    private Integer pageSize;
    /**
     * 总条数
     */
    private Integer rowCount;
    /**
     * 当前页码
     */
    private Integer pageCurrent;
    /**
     * 总页数
     */
    private Integer pageCount;
    /**
     * 封装商品信息
     */
    private List<E> goodsRecords;

    public PageObject() {
    }

    public PageObject(Integer pageSize, Integer rowCount, Integer pageCurrent, List<E> goodsRecords) {
        this.pageSize = pageSize;
        this.rowCount = rowCount;
        this.pageCurrent = pageCurrent;
        this.goodsRecords = goodsRecords;
        this.pageCount = (rowCount - 1) / pageSize + 1;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getRowCount() {
        return rowCount;
    }

    public void setRowCount(Integer rowCount) {
        this.rowCount = rowCount;
    }

    public Integer getPageCurrent() {
        return pageCurrent;
    }

    public void setPageCurrent(Integer pageCurrent) {
        this.pageCurrent = pageCurrent;
    }

    public Integer getPageCount() {
        return pageCount;
    }

    public void setPageCount(Integer pageCount) {
        this.pageCount = pageCount;
    }

    public List<E> getGoodsRecords() {
        return goodsRecords;
    }

    public void setGoodsRecords(List<E> goodsRecords) {
        this.goodsRecords = goodsRecords;
    }

    @Override
    public String toString() {
        return "PageObject{" +
                "pageSize=" + pageSize +
                ", rowCount=" + rowCount +
                ", pageCurrent=" + pageCurrent +
                ", pageCount=" + pageCount +
                ", goodsRecords=" + goodsRecords +
                '}';
    }
}
